#!/bin/sh  

echo 1 > /proc/sys/net/ipv4/ip_forward

cd /usr/bin/wg0
ip link add dev wg0 type wireguard
ip address add dev wg0 192.168.20.1/24
wg setconf wg0 config.conf
ip link set up dev wg0

cd /usr/bin/wg1
ip link add dev wg1 type wireguard
ip address add dev wg1 192.168.30.1/24
wg setconf wg1 config.conf
ip link set up dev wg1

ip rule add from 192.168.20.0/24 table 100
ip route add default via 192.168.30.2 table 100
ip route add 192.168.20.0/24 dev wg0 scope link src 192.168.20.1 table 100
